package com.pkk.components.rpc.page;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @description: 分页的请求类
 * @author: peikunkun
 * @create: 2018-08-13 18:14
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageRequest implements Serializable {
    /**
     * 当前页数
     */
    private Integer currentPage = 1;

    /**
     * 每页条数
     */
    private Integer pageSize = 10;


    /**
     * 获取当前页
     *
     * @return
     */
    public Integer getCurrentPage() {
        if (currentPage == null || currentPage <= 0) {
            currentPage = 1;
        }
        return currentPage;
    }

    /**
     * 获取当前每页显示的条数
     *
     * @return
     */
    public Integer getPageSize() {
        if (pageSize == null || pageSize <= 0) {
            pageSize = 10;
        }
        return pageSize;
    }


}
